//
//  ISNDProgressManager.m
//  iSchoolyard
//
//  Created by Ken on 14-8-11.
//  Copyright (c) 2014年 HunXun. All rights reserved.
//

#import "ISNDProgressManager.h"
#import "ISNDHUD.h"

//#import "QjNDAction.h"

static ISNDProgressManager *_shareProManager=nil;



@implementation ISNDProgressManager
@synthesize isUsedHuaView;
//@synthesize delegate;
@synthesize showStr;
@synthesize selReq;

-(id)init
{
    self=[super init];
    self.isUsedHuaView=YES;
    self.selReq=nil;
    
//    [[NSNotificationCenter defaultCenter] addObserver:self
//                                             selector:@selector(OnCancelReqPro:)
//                                                 name:OnCaneclHttpReq
//                                               object:nil];
    return self;
}

-(void)sendStart
{
    if (isUsedHuaView)
        return;
//    if (delegate && [delegate respondsToSelector:@selector(onStartPro:)])
//        [delegate onStartPro:self];
}

-(void)sendFinish
{
    if (isUsedHuaView)
        return;
//    if (delegate && [delegate respondsToSelector:@selector(onFinishPro:)])
//        [delegate onFinishPro:self];
}

+(id)shareProManager
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _shareProManager = [[ISNDProgressManager alloc] init];
    });
    
    return _shareProManager;
}

-(void)showHuaWithStr:(NSString *)messStr;
{
    if (isUsedHuaView)
        [ISNDHUD showUIBlockingIndicatorWithText:messStr];
    [self sendStart];
}
-(void)hideHua
{
    if (isUsedHuaView)
        [ISNDHUD hideUIBlockingIndicator];
    [self sendFinish];
}

-(void)OnCancelReqPro:(NSNotification *)notify
{
   // if (self.selReq)
    //{
       // DDLogCInfo(@"取消请求-%@",[self.selReq class]);
        [self hideHua];
//        self.selReq.isCanceled=YES;
        self.selReq=nil;
   // }
    
//    if (delegate && [delegate respondsToSelector:@selector(onCancelPro:)])
//        [delegate onCancelPro:self];
}
@end
